From : Manolis Pappas (el93637@central.ntua.gr)
Subject : Including shapes into executable
> > > Can someone provide me with some example
> > > code of including an IFF brush in a blitz program (executable). The
> > > program must be able to use this included graphic as a Shape.
>
> Rubbish, it IS possible, I do it all the time! :) Here's how I include
> an IFF brush as a Shape in my executables:
>
> s1
> IncBin "Brush1.iff" ; This is the IFF brush you want to include.
> e1
> a=WriteFile(0,"ram: "):WriteMem 0,?s1,?e1-?s1:CloseFile 0
> ; The above line saves the included brush to RAM temporarily.
> ;
> LoadShape 0,"ram: ":DeleteFile_ "ram: "
> ; The above line then loads the brush from RAM as a Shape and
> ; deletes it from RAM. Mission accomplished!
>
> The above method works 100% every time. You can even include sound
> effect files (8SVX) and replace "LoadShape" with "LoadSound" etc.
>
> The method may not be elegant, but it works. :)
Thank you very much or the answer. Another way that was proposed to me by
Ted Bailey is the following:
- load all the shapes I want to include with the LoadShape command.
- save all the shapes with the SaveShapes command (like a shape bank).
- Do the following
DecodeShapes 0,4,?initgrf
....(code)
initgrf:
IncBin "shapes"